<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>天天新闻网</title>
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CDN -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- Font Awesome 本地备份 -->
    <link rel="stylesheet" href="../css/all.min.css">
    <link rel="stylesheet" href="../css/fontawesome.min.css">
    <link rel="stylesheet" href="../css/solid.min.css">
    <!-- 自定义CSS -->
    <link rel="stylesheet" href="../css/admin.css">
    <!-- jQuery -->
    <script src="../js/jquery.min.js" a></script>
    <!-- Bootstrap JS -->
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    <!-- 添加Font Awesome CDN加载失败时的回退处理 -->
    <script>
        window.onload = function() {
            if (!window.FontAwesome) {
                console.log('Font Awesome CDN加载失败，使用本地文件');
            }
        };
    </script>
</head>
<body>
    <!-- 检查是否是管理员 -->
    <c:if test="${empty sessionScope.user || sessionScope.user.admin ne 'admin'}">
        <c:redirect url="../login.jsp"/>
    </c:if>

    <!-- 消息提示框 -->
    <c:if test="${not empty sessionScope.message}">
        <div class="message-popup" id="messagePopup">
            <div class="message-content">
                ${sessionScope.message}
            </div>
        </div>
        <% session.removeAttribute("message"); %>
        <script>
            // 显示消息提示
            window.onload = function() {
                var popup = document.getElementById('messagePopup');
                popup.style.display = 'block';
                
                // 3秒后自动消失
                setTimeout(function() {
                    popup.style.opacity = '0';
                    setTimeout(function() {
                        popup.style.display = 'none';
                    }, 500);
                }, 3000);
            };
        </script>
    </c:if>

    <div class="container-fluid">
        <div class="row">
            <!-- 引入侧边栏 -->
            <jsp:include page="admin_sidebar.jsp">
                <jsp:param name="active" value="${param.active}"/>
            </jsp:include>
        </div>
    </div>
